<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/jsp/common/common.jsp" %>
</head>
<body>

<div class="tableMainWarp">
  <div class="top-div"><em></em><span>&nbsp;>&nbsp;我的任务&nbsp;>&nbsp;所有任务</span></div>
  <div>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="search-table">
      <tr>
        <td style="float: right;">
	        <button class="btn-table" id="searchButton">查询</button>
        </td>
      </tr>
    </table>
  </div>
  <div class="tablelist">
    <div class="tabcon" id="middleCon"  style="overflow: auto;"></div>
    <div id="paginationDiv"  class="page clearfix"></div>
  </div>
</div>


<script type="text/javascript">
$(document).ready(function(){
	
	var bodyHt=document.documentElement.clientHeight;
	var tableDivHeight = bodyHt-147;	
	$('#middleCon').height(tableDivHeight);
	
	getPageData();

	blindPageElement();
	
});

function blindPageElement(){

	$('#searchButton').on('click',function(){
		$('#middleCon').tablegrid('reload');
	});
}

function getPageData(){
 	
	var url = '<%=basePath%>/webframework/monitor/systemMonitor/getThreadPoolData.do?method=1';
	
	$('#middleCon').tablegrid({
		url: url,
		columns:[	
		   	        {field:'threadId',title:'ID',width:3},
		   	        {field:'threadName',title:'名称',width:10},
		   	        {field:'threadState',title:'状态',width:9},
		   	     	{field:'cpuTime',title:'CPU',width:4},
		   	        {field:'blockedCount',title:'阻塞计数',width:5},
		   	        {field:'blockedTime',title:'阻塞时间',width:5},
		   	        {field:'waitedCount',title:'等待计数',width:5},
		   	        {field:'waitedTime',title:'等待时间',width:5},
		   	        {field:'stackTraceElementList',title:'堆栈信息',width:54,formatter:contentFormatter}
			    ],
	    isPagination:false,
	    resizeColumns : true,
	    tableClass : 'table-form'
	});
}

function contentFormatter(value, rowdata, index){
	
	var content = '';
	$(value).each(function(index,entry){
		content = content + '<p>'+entry+'</p>';
	});
	
	return content;
}



</script>
</body>
</html>